import { Component, OnInit, HostBinding } from '@angular/core';
import { MatDialog } from '@angular/material';
import { CreateTaskComponent } from '../create-task/create-task.component';
import { MoveTasksComponent } from '../move-tasks/move-tasks.component';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { routerAnim } from '../../anims/router.anim';

@Component({
  selector: 'app-task-home',
  templateUrl: './task-home.component.html',
  styleUrls: ['./task-home.component.scss'],
  animations: [routerAnim]
})
export class TaskHomeComponent implements OnInit {
  @HostBinding('@routerAnim') state;
  lists = [{
    name: "未开始", items: [
      { name: "登录", desc: "登录功能" },
      { name: "主界面构建", desc: "主界面构建" },
      { name: "后台框架", desc: "后台框架" },
    ]
  },
  {
    name: "进行中", items: [
      { name: "登录", desc: "登录功能" },
      { name: "主界面构建", desc: "主界面构建" },
      { name: "后台框架", desc: "后台框架" },
    ]
  }]
  constructor(private dialog: MatDialog) { }

  ngOnInit() {
  }
  taskCreatedHandler(e) {
    this.dialog.open(CreateTaskComponent, { data: {title:"新建任务:"}});
  }
  moveClickedHanlder() {
    this.dialog.open(MoveTasksComponent);
  }
  onItemClick(item) {
    this.dialog.open(CreateTaskComponent, { data: { title: "编辑任务:" } });
  }
  delBtnClickedHandler(e){
    const dialogRef = this.dialog.open(ConfirmDialogComponent, { data: { title: "警告", content: "您确认删除该任务吗？" } });
    dialogRef.afterClosed().subscribe(data => console.log(data));
  }
  sendBtnClickedHandler() {

  }
}
